<%@ page language="java" pageEncoding="utf8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>"
			type="text/css" />
	</head>
	<body style="">
		<div id="headBar" class="head_content"></div>
		<div id="main" class="main_content">
			<form method="post" id="gift_form" enctype="multipart/form-data"
				action="mt_gift_save.html">
				<input name="marketGift.giftId" value="${marketGift.giftId }" type="hidden" />
				<input name="marketGift.limitLevel" value="unuse_attribute" type="hidden"> 
				<div class="tableform">
					<div class="division">
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody>
								<tr>
									<th>
										赠品名称：
									</th>
									<td>
										<input value="${marketGift.name}" class="x-input " name="marketGift.name" type="text">
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="division">
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody>
								<tr>
									<th>
										赠品分类：
									</th>
									<td>
										<select name="marketGift.giftCatId">
										<c:forEach var="cat" items="${marketGiftCats}"	varStatus="giftIndex">
											<option value="${cat.giftCatId}">${cat.giftCatName }</option> 
										</c:forEach>
											
										</select>
									</td>
								</tr>
								 
								<tr>
									<th>
										发布：
									</th>
									<td>
										<select name="marketGift.showOn">
											<option value="true">是</option>
											<option value="false">否</option>
										</select>
									</td>
								</tr>
								<tr>
									<th>
										作为推荐赠品：
									</th>
									<td>
										<select name="marketGift.recommendOn">
											<option value="true">是</option>
											<option value="false">否</option>
										</select>
									</td>
								</tr> 
								<tr>
									<th>
										每人限购数量：
									</th>
									<td>
										<input   class="x-input " value="${marketGift.limitNum}"  style="width: 50px;" name="marketGift.limitNum"  type="text">
									</td>
								</tr>
								<tr>
									<th>
										兑换起始时间：
									</th>
									<td>										 
										<input size="10" id="gift_start_time"   name="marketGift.limitStartTimeString"  value="${marketGift.limitStartTimeString}"  class="cal cal"   type="text">
									</td>
								</tr>
								<tr>
									<th>
										兑换终止时间：
									</th>
									<td>
										<input size="10" id="gift_end_time"   name="marketGift.limitEndTimeString"  value="${marketGift.limitEndTimeString}"  class="cal cal"   type="text">
									</td>
								</tr> 
							</tbody>
						</table>
					</div>
					<div class="division">
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody>
								<tr>
									<th>
										价格：
									</th>
									<td>
										<fmt:message key="common_currency" />
										<input   class="x-input " style="width: 50px;" value="${marketGift.price}" name="marketGift.price"   type="text" />
									</td>
								</tr>
								<tr>
									<th>
										简介：
									</th>
									<td>
										<input class="x-input " name="marketGift.intro" value="${marketGift.intro}"	  type="text"/>
									</td>
								</tr> 
								<tr>
									<th>
										赠品页详细图：
									</th>
									<td>
										<input   class="x-input " name="upload"   type="file" />
									</td>
								</tr>
								<tr>
									<th>
										兑换所需积分：
									</th>
									<td>
										<input  class="x-input "  value="${marketGift.point}"
											style="width: 50px;" name="marketGift.point"  type="text">
									</td>
								</tr>
								<tr>
									<th>
										重量：
									</th>
									<td>
										<input   class="x-input " style="width: 50px;" value="${marketGift.weight}" name="marketGift.weight"  type="text">
											克
									</td>
								</tr>
								<tr>
									<th>
										库存：
									</th>
									<td>
										<input  class="x-input "	style="width: 50px;" name="marketGift.storage" value="${marketGift.storage}"   type="text" />
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="division">
						<table border="0" cellpadding="0" cellspacing="0" width="100%">
							<tbody>
								<tr>
									<th>
										详细描述：
									</th>
									<td>
										<textarea cols="80" id="editor1" name="marketGift.giftDescribe" rows="10">
											${marketGift.giftDescribe}
										</textarea>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<div class="table-action">
						<button type="submit" class="btn">
							<span><span>完成</span>
							</span>
						</button>
					</div>
				</div>
			</form>
		</div>
		<div id="footBar" class="foot_content"></div>



		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/ckeditor.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/adapters/jquery.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.validate.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.core.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.widget.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/ui/jquery.ui.datepicker.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/ui/i18n/jquery.ui.datepicker-zh-CN.js'/>"></script>
		<script type="text/javascript">
		var config = {
		toolbar:
		[
			[ 'Bold', 'Italic', 'Underline', 'StrikeThrough', '-',
							'Subscript', 'Superscript' ],
					[ 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent',
							'Blockquote' ],
					[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
							'JustifyFull' ],
					[ 'Link', 'Unlink', 'Anchor' ],
					[ 'Style', 'FontFormat', 'FontName', 'FontSize' ],
					[ 'Image', 'Flash', 'Table', 'Rule', 'Smiley',
							'SpecialChar' ], [ 'TextColor', 'BGColor','Source' ]
		],
		filebrowserImageUploadUrl : '<c:url value="/uploadFile.html?Type=Image"/>'
	};
	$('#editor1').ckeditor(config);    
		
		
		
		
		
		//$('#gift_cat_showOn').attr('value','${marketGift.showOn}');
		
	$(document).ready(function() {
		var validator = $("#gift_form").validate( {
			errorElement : "div",
			errorClass : "x-vali-error",
			onfocusout : false,
			rules : {
				'marketGift.name' : "required",
				'marketGift.limitNum' : {
					required : true,
					number : true
				},
				'marketGift.limitStartTimeString' : "required",
				'marketGift.limitEndTimeString' : "required",
				'marketGift.price' : {
					required : true,
					number : true
				},
				'marketGift.intro' : "required",
				'marketGift.point' : {
					required : true,
					number : true
				},
				'marketGift.weight' : {
					required : true,
					number : true
				},
				'marketGift.storage' : {
					required : true,
					number : true
				}
			},
			messages : {
				'marketGift.name' : "必填字段",
				'marketGift.limitNum' : {
					required : "必填字段",
					number : "请输入数字"
				},
				'marketGift.limitStartTimeString' : "必填字段",
				'marketGift.limitEndTimeString' : "必填字段",
				'marketGift.price' : {
					required : "必填字段",
					number : "请输入数字"
				},
				'marketGift.intro' : "必填字段",
				'marketGift.point' : {
					required : "必填字段",
					number : "请输入数字"
				},
				'marketGift.weight' : {
					required : "必填字段",
					number : "请输入数字"
				},
				'marketGift.storage' : {
					required : "必填字段",
					number : "请输入数字"
				}
			},
			errorPlacement : function(error, element) {
				element.removeClass('x-vali-error');
				error.appendTo(element.parent());

			},
			 
			success : function(div) { 
				$(div).remove();
			}
		});
	});
	
	
	$("#gift_start_time").datepicker( $.datepicker.regional['zh-CN']);
	$("#gift_end_time").datepicker( $.datepicker.regional['zh-CN']);
</script>
	</body>
</html>